﻿using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Threading;
using System.Xml.Linq;
using Microsoft.SharePoint;
using System.Text.RegularExpressions;

namespace LizardSoft.Common.FlexibleStructureDeployment
{
    public static partial class StructureHelper
    {
        private static SPList GetSPListFromFolderUrl(SPWeb web, string folderUrl)
        {
            string listUrl = String.Format("{0}/{1}", web.ServerRelativeUrl, folderUrl);
            listUrl = listUrl.Replace("//", "/");
            try
            {
                return web.GetList(listUrl);
            }
            catch (Exception ex)
            {
                string message = String.Format(
                    "GetSPListFromFolderUrl: Список {0} не найден. ListUrl: {1}. Error: {2}", 
                    folderUrl,
                    listUrl,
                    ex.Message);
                throw new Exception(message, ex);
            }
        }
    }
}
